class MyQueue {
        private Stack<Integer> InStack;// 输入栈
        private Stack<Integer> OutStack;// 输出栈
    public MyQueue() {
        InStack = new Stack<>();// 输入栈
        OutStack = new Stack<>();// 输出栈
    }
    
    public void push(int x) {
        InStack.push(x);
    }
    
    public int pop() {
      if(OutStack.isEmpty()){
          while(!InStack.isEmpty())
            OutStack.push(InStack.pop());
      }
        return OutStack.pop();
    }
    
    public int peek() {
        if(OutStack.isEmpty()){
          while(!InStack.isEmpty())
            OutStack.push(InStack.pop());
        }
        return OutStack.peek();
    }
    
    public boolean empty() {
        return InStack.isEmpty() && OutStack.isEmpty();
    }
}

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue obj = new MyQueue();
 * obj.push(x);
 * int param_2 = obj.pop();
 * int param_3 = obj.peek();
 * boolean param_4 = obj.empty();
 */